package wyj.com.startappactivity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * @author 王永吉
 * @date 2018/10/18 16:39
 */
public class MyReceive extends BroadcastReceiver {
    static final String action_boot = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.e("BroadcastReceivereeeee", "" + "BroadcastReceivereeeee--->" + intent.getAction());
        Intent mBootIntent = new Intent(context, MainActivity.class);
        // 下面这句话必须加上才能开机自动运行app的界面
        mBootIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(mBootIntent);
    }
}
